import utils.TreeNode;

/**
 * @author ZCR
 * @create 2025/9/4 22:23
 */
public class Solution101 {
    public boolean isSymmetric(TreeNode root) {
        if (root == null) {
            return true;
        }else{
            return checkSymmetric(root.left, root.right);
        }

    }
    public boolean checkSymmetric(TreeNode left, TreeNode right) {
        if (left == null || right == null) {
            return left == right;
        }
        if (left.val != right.val) {
            return false;
        }
        return checkSymmetric(left.left, right.right) && checkSymmetric(left.right, right.left);
    }
}
